28. Exercise: Create and Apply Styles
Create and Apply Styles
Create and apply the following four styles to Sunshine layouts:
- An action bar style that shows a Sunshine logo instead of a title; named “ActionBar.Solid.Sunshine.NoTitle”
- A style for MainActivity called AppTheme.Forecast that uses the custom ActionBar style
- A DetailLabel style that contains all the common style attributes
- An ExtraWeatherMeasurement style that contains all the repeated style attributes
Exercise Code
Exercise: S12.02-Exercise-Styles
Create and Apply Styles
SOLUTION:
- Create a style that shows a Sunshine logo instead of a title
- Create a style for MainActivity called AppTheme.Forecast that uses our custom ActionBar style
- Create the DetailLabel style
- Create the ExtraWeatherMeasurement style
- Use AppTheme.Forecast as the MainActivity's new theme
- Apply newly created styles to their respective views and layouts